package com.edu.exam.widget;

import android.app.AlertDialog;
import android.app.Dialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

import com.edu.exam.activity.ChapterPracticeActivity;
import com.edu.exam.activity.MyApllication;
import com.edu.exam.activity.QuestionBase;
import com.edu.exam.activity.R;
import com.edu.exam.activity.RandomExerciseActivity;
import com.edu.utils.DBTools;

public class AlertSkip {
	RandomExerciseActivity randomExerciseActivity;
	View view;
	String noteString=null;
	int count=0;
	Dialog dialog;

	public AlertSkip(RandomExerciseActivity chapterPracticeActivity,int count) {
//		super();
		this.count=count;
		this.randomExerciseActivity = chapterPracticeActivity;
		LayoutInflater inflater=LayoutInflater.from(chapterPracticeActivity);
		view=inflater.inflate(R.layout.alertnote, null);
	}

	public String show() {
		dialog =new AlertDialog.Builder(randomExerciseActivity).setTitle("1--"+count).setView(view).create();
		
		final EditText editText=(EditText) view.findViewById(R.id.alertnoteEdit);
		Button button2=(Button) view.findViewById(R.id.alertnoteOK);
		Button button3=(Button) view.findViewById(R.id.alertnoteCancle);
		
		button2.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				
				String no=editText.getText().toString();
				randomExerciseActivity.initValues(Integer.parseInt(no));
				
				dialog.hide();
			}
		});
		button3.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				dialog.hide();
				
			}
		});
		dialog.show();
		
		return null;

	}
	public void dismiss() {
		dialog.dismiss();
	}
	
}
